﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using WmsApp.Service;
using WmsApp.WindowControl;

namespace WmsApp.WmsService
{
    public partial class PayApplyBillWrap
    {
        public bool IsNeedSaved()
        {
            if (this.FPayApplyBill != null)
            {
                if (this.FPayApplyBill.PayApplyState != Constant.BillStateDraft)
                {
                    return false;
                }

                if (this.FPayApplyBill.WcfEntityState == EntityState.Added || this.FPayApplyBill.WcfEntityState == EntityState.Modified)
                {
                    return true;
                }
                if (this.FPayApplyBillDtl != null && this.FPayApplyBillDtl.Count > 0)
                {
                    return this.FPayApplyBillDtl.Any(dtl => dtl.WcfEntityState == EntityState.Added || dtl.WcfEntityState == EntityState.Modified);
                }
            }
            return false;
        }
    }
}
